package top.conangao.common.web.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import top.conangao.common.entity.ResponseResult;

/**
 * @author ConanGao
 * @description
 * @since 2023/12/16 14:54
 **/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Throwable.class)
    public ResponseResult<String> handle(Throwable e) {
        log.error("错误信息：{}", e.getMessage());
        return ResponseResult.fail(e.getMessage());
    }
}
